package org.robert.export_client.excel.entity;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.robert.export_client.excel.builder.ExcelSheetDataPathBuilder;
import org.robert.export_client.excel.builder.WorkbookDataPathBuilder;
import org.robert.export_client.excel.metadata.AbstractSheetBuilder;
import org.robert.export_client.excel.metadata.AbstractWorkbookBuilder;
import org.robert.export_client.excel.metadata.AbstractWorkbookWrite;

import java.util.Map;

/**
 * WorkbookWrite:
 *
 * @author zhaoshengtao
 * @date 2024/01/22
 */
@Slf4j
@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
public class WorkbookPathWrite extends AbstractWorkbookWrite {

    private WorkbookDataPathBuilder workbookBuilder;

    public WorkbookPathWrite(WorkbookDataPathBuilder workbookBuilder) {
        this.workbookBuilder = workbookBuilder;
    }

    @Override
    public ExcelSheetDataPathBuilder createSheet(String sheetName, Class<?> clazz, Map<String, Map<String, String>> dictMap) throws Exception {

        return this.workbookBuilder.createSheet(sheetName, clazz, dictMap);
    }


    public void finish(WriteSheet writeSheet) {
        writeSheet.getSheetBuilder().finish();
    }

}
